<!DOCTYPE HTML>
<html>
<head>
    <meta charset="utf-8">
    <meta name="apple-mobile-web-app-capable" content="yes"/>
    <meta name="apple-mobile-web-app-status-bar-style" content="black"/>
    <meta name="format-detection" content="telephone=no">
    <meta name="viewport" content="minimum-scale=1.0,maximum-scale=1,width=device-width,user-scalable=no"/>
    <title>WS测试</title>


</head>

<body>
<section class="nav">
    <div class="subNav">
        <div class="slipMarquee" id="stock">

        </div>
        <div>
            <input type="text" id="txt"/>
            <button value="send" onclick="send();">send</button>
        </div>
    </div>
</section>
<script src="sockjs.js"></script>
<script language="javascript" type="text/javascript">
    window.sockJsConn = new SockJS('http://localhost:3333/websocket', null, {sessionId: 123}) // sessionId使用类型function
    window.sockJsConn.onmessage = function (e) {
        console.log(e)
    }
    function send() {// 发送输入
        window.sockJsConn.send(document.getElementById('txt').value);
    }

</script>

</body>

</html>
